package com.china.produce.listener;

import com.alibaba.fastjson.JSON;
import com.china.produce.pojo.OrderMessage;
import org.apache.rocketmq.spring.annotation.ConsumeMode;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

/**
 * @ClassName
 * @Author niujie
 * @Version
 * @Description
 * @CreateTime 2025/8/17
 */
@Component
@RocketMQMessageListener(topic = "order_topic", consumerGroup = "test-consumer-group", consumeMode = ConsumeMode.ORDERLY)
public class SxMessageConsumerListener implements RocketMQListener<String> {
    @Override
    public void onMessage(String message) {
        OrderMessage orderMessage = JSON.parseObject(message, OrderMessage.class);

        System.out.println("orderMessage: " + orderMessage);
    }
}
